<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="{{basePackage}}.mapper.{{entityName}}Mapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="{{basePackage}}.entity.{{entityName}}">
        {{#each fields}}
        {{#if isPrimaryKey}}
        <id column="{{columnName}}" property="{{fieldName}}" />
        {{else}}
        <result column="{{columnName}}" property="{{fieldName}}" />
        {{/if}}
        {{/each}}
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        {{#each fields}}{{columnName}}{{#unless @last}}, {{/unless}}{{/each}}
    </sql>

    {{#if hasCustomQueries}}
    {{#each customQueries}}
    <!-- {{description}} -->
    <{{sqlType}} id="{{methodName}}" {{#if (eq sqlType "select")}}resultMap="BaseResultMap"{{/if}}>
        {{sql}}
    </{{sqlType}}>

    {{/each}}
    {{/if}}

    <!-- 关联关系查询SQL将在后续版本中支持 -->

</mapper>
